import 'package:flutter/material.dart';

void main() =>runApp(MyApp(
));

class mxl{
  String age;
  String desc;
  mxl(this.age,this.desc);
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: "Row Widgth demo",
        home: ProdcutList(prodcuts: List.generate(20, (i)=>mxl("fqfq", "$i")),)
    );
  }
}

class ProdcutList extends StatelessWidget {
  final List<mxl> prodcuts;
  ProdcutList({Key key,@required this.prodcuts}):super(key:key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("找小姐姐要电话"),
      ),
      body:ListView.builder(
        itemCount: prodcuts.length,
        itemBuilder: (context,index){
          return ListTile(
            title: Text(prodcuts[index].desc),
            onTap: (){
              Navigator.push(
                  context,
                  MaterialPageRoute(
                      builder: (context)=> ProdectDetail(m: prodcuts[index])
                  )
              );
            },
          );
        },
      ),
    );
  }
}

class ProdectDetail extends StatelessWidget {
  final mxl m;
  ProdectDetail({Key key,@required this.m}):super(key:key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("${m.desc}"),),
      body:Center(
        child: RaisedButton(
            color: Colors.pinkAccent,
            child: new Text("测试底部弹出"),
            onPressed: (){
//              Scaffold.of(context).showSnackBar(SnackBar(content:new Text("我就看看这怎么提示")));
            }),
      ),
    );
  }
}

